<?php

namespace App\ApiBackend\Admin;

use App\Domains\AdminDomain;
use App\Http\Controllers\ApiBaseController;
use Illuminate\Support\Facades\DB;

/**
 *  用户信息
 */
class PersonInfo extends ApiBaseController
{

  /**
   * 参数检查
   */
  protected function check(): void
  {
  }

  /**
   * 业务主体
   */
  protected function service(): void
  {
    $adminId = \request()->user()->adminId;

    //数据
    try {
      $adminInfo = DB::table('admin')->where('adminId', $adminId)->first([
        'email',
        'phone',
        'name',
      ]);
      $this->result['data'] = $adminInfo;

    } catch (\Exception $exception) {
      $this->result["code"] = 1;
      $this->result["message"] = "失败: " . $exception->getMessage();
    }


    return;
  }
}
